Skip to main content

ESP32 USB Stack

usb_interconnection

Work in Progress

  1. Creating a communication link over USB to send measurements from the root node to host computer.

    1. Establish connection via TinyUSB stack from ESP32-S3
    2. Start Serial port listner in C on Linux computer.
    3. Check the possibility of letting the middleware handle the data sequencing. - Sending it manually would be the way.
  2. Send measurement data from root to host.

    1. Pack and send measurement data over USB
    2. Read and parse the data to reconstruct the mesurements in Linux Computer.
  3. Next steps

    • Resolve issue with ACM0 (Auto detecting the USB port name)

    • Differentiating between measurements (open and close usb connection)

      The max tx packet size seems to be 64 bytes. Hence we will have to chunk down the measurements once again in the root node prior to sending over USB.

Details

ESP32 S series is able to work as a USB device as well as a USB host.
ESP-IDF USB device stack is based on TinyUSB which is a USB stack written for embedded devices.
We are making use of CDC (ACM): Communication Device Class (Abstract Control Model), for sending data.

API calls

  • tinyusb_cdcacm_write_queue will hold up upto 64bytes till it is successfully flushed through tinyusb_cdcacm_write_flush call. Once the queue is filled it won't accept further bytes.

  • TinyUSB can have issues with synchronous tx and rx. Make sure you don't tx data while expecting rx data.

  • CONFIG_TASK_WDT_TIMEOUT_S, a setting in menuconfig. Increasing the watchdog timer value can avoid WDT being triggered.